package com.neuedu.hcp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.RecoveryRegister;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.mapper.RecoveryRegisterMapper;
import com.neuedu.hcp.service.IRecoveryRegisterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class RecoveryRegisterServiceImpl extends ServiceImpl<RecoveryRegisterMapper, RecoveryRegister> implements IRecoveryRegisterService {

    @Autowired
    private RecoveryRegisterMapper recoveryRegisterMapper;

    @Override
    public RespPageBean getRegisterByPage(Integer currentPage, Integer size, RecoveryRegister recoveryRegister) {
        Page<RecoveryRegister> page = new Page<>(currentPage,size);
        IPage<RecoveryRegister> recoveryRegisterByPage = recoveryRegisterMapper.getRegisterByPage(page,recoveryRegister);
        RespPageBean respPageBean = new RespPageBean(recoveryRegisterByPage.getTotal(),recoveryRegisterByPage.getRecords());
        return respPageBean;
    }

    @Override
    public int insert(RecoveryRegister recoveryRegister) {
        return recoveryRegisterMapper.insert(recoveryRegister);
    }
}
